<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="${namespace}">
<#--<#if !simple>-->
    <resultMap id="BaseResultMap" type="${beanReference}">
        <#list originalFileds as filed>
            <#if filed.primaryKey && filed.originalName=="id">
            <id column="${filed.originalName}" property="${filed.backCamelName}"/>
            <#else>
            <result column="${filed.originalName}" property="${filed.backCamelName}"/>
            </#if>
        </#list>
    </resultMap>
    <sql id="BaseSet">
        <set>
            <#list originalFileds as filed>
            <#if !filed.primaryKey>
            <if test="bean.${filed.backCamelName} != null">
                ${filed.escapesName} = ${r"#{"}bean.${filed.backCamelName}},
            </if>
            </#if>
            </#list>
        </set>
    </sql>
    <select id="selectByUid" resultType="${beanReference}">
        select * from ${tableName}
        where uid=${r"#{"}uid}
    </select>
    <update id="updateByUid">
        update ${schema}${tableName}
        <include refid="BaseSet"></include>
        where id = ${r"#{"}bean.uid}
    </update>
</mapper>